package main

import (
	"fmt"
	"reflect"
	"sort"
)

func getMaximumConsecutive(coins []int) int {
	sort.Ints(coins)
	r := 1
	for _, coin := range coins {
		if coin > r {
			break
		}
		r += coin
	}
	return r
}

type Computer struct{}

func (c *Computer) App(a int) int {
	return a
}

func main() {
	//fmt.Println(getMaximumConsecutive([]int{1, 2, 2, 2, 9}))

	//a := 10
	//(int).a
	a := 10
	var c *Computer
	fmt.Println(reflect.TypeOf(a))
	fmt.Println(reflect.TypeOf(c))
	fmt.Println("==============")
	m, ok := reflect.TypeOf(c).MethodByName("App")
	fmt.Println(m, ok)

	paramList := []reflect.Value{reflect.ValueOf(c), reflect.ValueOf(a)}
	fmt.Println(m.Func.Call(paramList)[0].Int())

	b := func(a int) int {
		return a
	}

	d := reflect.ValueOf(b)
	fmt.Println(d)
	fmt.Println("==============")
	fmt.Println(d.Kind()) // 判断是否是 函数 映射
	fmt.Println(d.Type())
	fmt.Println(m.Func.Kind()) // 判断是否是 函数 映射
	fmt.Println(m.Func.Type())
	fmt.Println(paramList[0].Kind())
	fmt.Println(paramList[0].Type())
}
